package com.zjw.zy.componse.demo.viewmodel

import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import com.zjw.zy.componse.demo.R
import com.zjw.zy.componse.demo.base.BaseViewModel
import com.zjw.zy.componse.demo.bean.GameBean
import java.util.*

/**
 * @author     ：zhong.jw
 * @date       ：Created in 2023/2/20 9:01
 * @description：
 */
class GameListViewModel : BaseViewModel() {


    private val mList = mutableStateOf<List<GameBean>>(Collections.emptyList())
    val list: State<List<GameBean>> by this::mList


    fun requireGameList(filter: String = "") {
        ArrayList<GameBean>().apply {
            add(GameBean("扫雷", R.drawable.weather_icon_sun1, R.id.mineGameFragment))
            add(GameBean("某大型3D游戏", R.drawable.weather_icon_sun1, R.id.unitySimpleDemoStubFragment))
//            add(GameBean("扫雷2", R.drawable.weather_icon_sun1, R.id.mineGame2Fragment))
            add(GameBean("五子棋", R.drawable.weather_icon_sun1, R.id.gobangGameFragment))
            add(GameBean("小球", R.drawable.weather_icon_sun1, R.id.bollFragment))
            add(GameBean("旋转手势", R.drawable.weather_icon_sun1, R.id.rotateTestFragment))
            add(GameBean("扩展列表", R.drawable.weather_icon_sun1, R.id.expandListFragment))
            add(GameBean("滑动视频", R.drawable.weather_icon_sun1, R.id.slideFragment))
        }.let { it -> mList.value = it.filter { it.name.contains(filter, true) } }
    }
}